// 引入组件
import Home from '../view/login/index.jsx';
import React from 'react';
import HomePage from '../view/home/index.jsx';
import { Navigate } from 'react-router-dom';
import Shooping from '../view/shopping/index.jsx';
import Mine from '../view/mine/index.jsx';
import Order from '../view/order/index.jsx';
import GoodsDetail from '../view/goods/index.jsx';


// 注册路由数组
const routes = [
  {
    // 登录页
    path: '/login',
    element: <Home />
  },
  {
    // 首页
    path: '/home',
    element: <HomePage />
  },
  {
    // 购物车
    path: '/shopping',
    element: <Shooping />
  },
  {
    // 我的页面
    path: '/mine',
    element: <Mine />
  },
  {
    // 订单页面
    path: '/order',
    element: <Order></Order>
  },
  {
    // 商品详情
    path: '/goods/:id',
    element: <GoodsDetail />
  },
  {
    // 404
    path: '/404',
    element: <div>404</div>
  },
  {
    // 默认重定向到登录页
    path: '/',
    element: <Navigate to="/login" />
  },
  {
    // 通配符路由，重定向到登录页
    path: '*',
    element: <Navigate to="/login" />
  }
];

// 导出
export default routes;